package main

import (
  "sdl"
  //"log"
  //"fmt"
)

type Base struct {
  x, y, w, h int
  parent *Window
}

func (d *Base) getX() int {
  return d.x
}
func (d *Base) setX(x int) {
  d.x = x
}

func (d *Base) getY() int { 
  return d.y
}
func (d *Base) setY(y int) {
  d.y = y
}

func (d *Base) getWidth() int {
  return d.w
}
func (d *Base) getHeight() int {
  return d.h
}

func (d *Base) getSubwindows() []Window {
  return nil
}

func (d *Base) getParent() Window {
  return d
}


func (d *Base) draw(surface *sdl.Surface) {
  surface.FillRect(&sdl.Rect{int16(d.x), int16(d.y), uint16(d.w), uint16(d.h)}, 100000);
  //log.Stderrf("Drawing window %p", d)
}
func (d *Base) update() { }

func (d *Base) getWidgetAt(x int, y int) Window { 
  if x >= d.x && x <= d.x + d.w && y >= d.y && y <= d.y + d.h {
    return d
  }
  return nil
}

func (d *Base) pointerDragged(x, y int) { }
func (d *Base) pointerPressed(x, y int) { }
func (d *Base) pointerReleased(x, y int) { }

func (d *Base) keyPressed(key int) { }
func (d *Base) keyReleased(key int) { }
